import { defineStore } from 'pinia'
import type { RouteRecordRaw } from 'vue-router'
import type { MenuPageVO } from '@/types/sec/menu'

export const useRouterStore = defineStore('router', {
	state: () => ({
		menuList: [] as MenuPageVO[], // 后端原始菜单数据
		navMenuList: [] as Array<RouteRecordRaw>, // Element菜单导航数据
		routeList: [] as Array<RouteRecordRaw> // 路由导航数据
	}),
	// persist: {storage: sessionStorage},
	actions: {
		setMenuList(menuList: Array<MenuPageVO>) {
			this.menuList = menuList
		},
    setNavMenuList(navMenuList: Array<RouteRecordRaw>) {
			this.navMenuList = navMenuList
		},
		setRouteList(routeList: Array<RouteRecordRaw>) {
			this.routeList = routeList
		}
	}
})
